﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace QWeiBoN.Util
{
    public class FaceHelper
    {
        public class Face
        {
            public string Key { get; set; }
            public string FacePath { get; set; }
        }

        #region 私有属性

        /// <summary>
        /// 表情文件扩展名
        /// </summary>
        const string FaceImageExt = ".png";
        /// <summary>
        /// 表情文件目录
        /// </summary>
        const string FaceImageDir = "/Resources/face";

        #endregion

        /// <summary>
        /// 表情名字
        /// </summary>
        private static List<string> FaceKeys = new List<string> { 
            "no", "ok", "乒乓", "便便", "偷笑", "傲慢", "再见", "冷汗", "凋谢", "刀", 
            "勾引", "发呆", "发怒", "发抖", "可怜", "可爱", "右哼哼", "右太极", "吐", 
            "吓", "咒骂", "咖啡", "哈欠", "啤酒", "嘘", "回头", "困", "坏笑", "大兵", 
            "大哭", "太阳", "亲亲","奋斗", "呲牙", "委屈", "骷髅","害羞", "尴尬", "左哼哼", "左太极", "差劲", 
            "弱", "强", "得意", "微笑", "心碎", "快哭了", "怄火", "惊恐", "惊讶", "憨笑", 
            "抓狂", "折磨", "抠鼻", "抱拳", "拥抱", "拳头", "挥手", "握手", "撇嘴", "擦汗", 
            "敲打", "晕", "月亮", "流汗", "流泪", "激动", "炸弹", "爱你", "爱心", "爱情",
            "猪头", "献吻", "玫瑰", "瓢虫", "疑问", "白眼", "睡", "磕头", "示爱", "礼物", 
            "篮球", "糗大了", "胜利", "色", "菜刀", "蛋糕", "街舞", "衰", "西瓜", "调皮", 
            "足球", "跳绳", "跳跳", "转圈", "鄙视", "酷", "闪电", "闭嘴", "阴险", "难过", 
            "飞吻", "饥饿", "饭",  "鼓掌" };

        /// <summary>
        /// 获取表情的路径
        /// </summary>
        /// <returns></returns>
        public static string GetFaceUrl(string facekey)
        {
            return string.Format("{0}/{1}{2}", FaceImageDir, facekey, FaceImageExt);
        }

        /// <summary>
        /// 判断表情是否存在
        /// </summary>
        /// <param name="faceCode"></param>
        /// <returns></returns>
        public static bool Exist(string faceCode)
        {
            return FaceKeys.Contains(faceCode);
        }

        /// <summary>
        ///  表情数据
        /// </summary>
        /// <returns></returns>
        public static List<Face> Faces()
        {
            var rs = new List<Face>();
            for (int i = 0; i < FaceKeys.Count; i++)
            {
                var f = FaceKeys[i];
                rs.Add(new Face
                {
                    Key = f,
                    FacePath = GetFaceUrl(f)
                });
            }
            return rs;
        }
    }
}
